<template>
  <view>
    <!-- 未授权 -->
    <view class="noAuth">
      <image src="/static/xslogo.png" mode="widthFix"></image>
      <view class="title">劳动教育管理平台学生端</view>
       <input type="number" placeholder="请输入学号" placeholder-class="fs-28 col333" v-model="studentID">
       <view class="phone-warp">
         <input type="number" placeholder="请输入手机号" placeholder-class="fs-28 col333" v-model="phone">
         <view class="code">获取验证码</view>
       </view>
        <input type="number" placeholder="请输入验证码" placeholder-class="fs-28 col333" v-model="code">

        <!--  @getuserinfo="getUserInfo" -->
        <button open-type="getUserInfo">绑定微信并登录</button>

      <view class="xy-warp">
       <view class="xy">
         <radio value="r1" :checked="isAgree"   @click="isAgree = !isAgree"/>
          <view class="fs-24 col888">已阅读并同意 
            <text style="color: #4878FF;" @click="toPage('1')">《用户协议》</text> 
            <text style="color: #4878FF;" @click="toPage('2')">《隐私协议》</text> 
          </view>
       </view>
      </view>

      
    </view>


    <!-- 已授权 -->
    <view></view>
    <!-- 底部 -->
    <view class="footer">技术支持由山东风正信息科技有限公司提供</view>



  </view>
</template>

<script>
  export default {
    data() {
      return {
        isAgree:false,
        schoolList:[],
        password:'',
        studentID:'',
        phone:'',
        code:''
      };
    },
    onLoad() {
      // if(uni.getStorageSync('token')){
      //   uni.switchTab({
      //     url:'/pages/index/index'
      //   })
      // }
    },
    methods:{
      // @click="$tools.goNext('/pages/login/agreement?type=1')"
      toPage(type){
        uni.navigateTo({
          url:'/pages/login/agreement?type='+type
        })
      },
      login(){
        if(!this.isAgree) return this.$tools.showtt('请阅读并同意协议')
        if(!this.studentID) return this.$tools.showtt('请输入学号')
        if(!this.password) return this.$tools.showtt('请输入密码')
        this.$tools.axiosFromToken('POST','login/login',{stNumber:this.studentID,password:this.password},'加载中').then(res => {
          if(res.code != 200) return this.$tools.showtt(res.msg)
          let {data:{token}} = res
          uni.setStorageSync('token',token)
          uni.switchTab({
            url:'/pages/index/index'
          })
        })
      }
    }
  }
</script>

<style lang="scss" scoped>
.noAuth{
  text-align: center;
  height: 100%;
  image{
    margin-top: 200rpx;
    width: 300rpx;
    height: 310rpx;
    // border: 2rpx solid pink;
    border-radius: 50%;
   
  }
  .title{
    font-size: 48rpx;
    margin: 20px 0;
  }
  input{
    text-align: left;
    width: 80%;
    height: 80rpx;
    margin: 30px auto;
    border: 1rpx solid #ccc;
    border-radius: 10rpx;
    padding-left: 20rpx;

  }
  .phone-warp{
    position: relative;
    .code{
      position: absolute;
      right: 12%;
      top: 20rpx;
      color: blue;
      cursor: pointer;
    }
  }
  button{
    width: 90%;
    height: 80rpx;
    background-color: blue;
    color: #fff;
    border-radius: 10rpx;
    margin: 20px auto;
    border-radius: 10px;
  }
  .xy-warp{
    padding-left: 10%;
    width: 80%;
    .xy{
      width: 100%;
      height: 80rpx;
      text-align: center;
      border-top: 2rpx solid #ccc;
      border-bottom: 2rpx solid #ccc;
      display: flex;
      align-items: center;
      justify-content: space-around;
    }
  }
  
}

.footer{
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100rpx;
  line-height: 100rpx;
  text-align: center;
}

</style>
